﻿Shader "Example01/05Shader"
{
    Properties
    {
        
    }
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"
            
            struct v2f
            {
                float4 pos :SV_POSITION;
                fixed3 color :Color;
            };
            
            fixed4 _MainColor ;

            v2f vert (appdata_full v)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.color = v.normal * 0.5 + fixed3(0.5,0.5,0.5);
                o.color = v.tangent * 0.5 + fixed3(0.5,0.5,0.5);
                o.color = fixed3(v.texcoord.xy,0);
                return o ;
            }

            fixed4 frag (v2f i) :SV_Target
            {
                return fixed4(i.color,1);
            }
            ENDCG
        }
    }
}